/**
 * Pangolin IM Server
 * autor:   yiyefangzhou24
 * email:   yiyefangzhou24@qq.com
 * data:    21/10/1
 */

#ifndef PANGOLINSERVER_REDIS_H
#define PANGOLINSERVER_REDIS_H

#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include <stdlib.h>
#include "hiredis.h"

#define VALUE_KEY   1
#define VALUE_TIME  2
#define VALUE_FD    3

bool init_redis_pool(char * host , int port);
void close_redis_pool();
char * redis_getlasterror();

void redis_flashall();
bool redis_save_userinfo(int uid , char * key ,int fd , int time);
bool redis_update_usertime(int uid , int time);
bool redis_get_userkey(int uid , char * key);
bool redis_del_userinfo(int uid);
int redis_get_userfd(int uid);
bool redis_del_userinfobyfd(int fd);
bool redis_check_useronline(int uid);
int redis_push_msg_queue(char *msg);
bool redis_check_relationship(int uid1 , int uid2);
bool redis_add_relationship(int uid1  , int uid2);
bool redis_del_relationship(int uid1 , int uid2);

#endif //PANGOLINSERVER_REDIS_H
